package com.jgp.control;

import com.jgp.domin.Book;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/books")
public class Bookcontrol {
    @PostMapping
    public String save(@RequestBody Book book){

        System.out.println("book save....");
        return "{'module':'book save success'}";
    }
    @GetMapping
    @RequestMapping("/query")
    public void quary(){
        System.out.println("登出成功");
    }
    @GetMapping
    @RequestMapping("/ery")
    public void ery(){
        System.out.println("ery");
    }
    @GetMapping
    public List<Book> getall(){
        System.out.println("book getall");
        List<Book> list = new ArrayList();
        Book book1 = new Book();
        book1.setType("计算机");
        book1.setName("spring入门教程");
        book1.setDescription("小试牛刀");
        Book book2 = new Book();
        book2.setType("计算机");
        book2.setName("spring实战教程");
        book2.setDescription("一代宗师");
        Book book3 = new Book();
        book3.setType("计算机丛书");
        book3.setName("spring实战无敌版");
        book3.setDescription("一代宗师呕心创作");
        list.add(book1);
        list.add(book2);
        list.add(book3);
        return list;
    }
}
